package com.gzhryc.net_marketing.supplier.erp.dao.db;

import com.gzhryc.common.NumberTools;
import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.net_marketing.supplier.erp.dao.enums.SupplierGoodsEnum;
import com.gzhryc.net_marketing.core.enums.EGoodsClassify;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;

@Table(name = "supplier_goods")
public class SupplierGoods {

	@Id(autoIncrement = 330000)
	@Column
	protected Long id;

	@Column(notNull = true,length = 64,note = "商品名称")
	protected String name;

	@Column(name="classify",notNull = true,defVal = "1",note = "商品类型，1：实物，2：虚拟")
	protected Integer classify;

	@Column(name="type_codes",length = 255)
	protected String typeCodes;

	@Column(name="type_names",length = 255)
	protected String typeNames;

	@Column(name="thumbnail_img",length = 128,note="缩略图")
	protected String thumbnailImg;

	@Column(name="imgs",length = 2048,note="商品图")
	protected String imgs;

	@Column(name="detail_imgs",length = 2048,note="详情图")
	protected String detailImgs;

	@Column(length = 255, note = "标签集")
	protected String labels;

	@Column
	protected String code;

	@Column(name = "pay_money",notNull = true,defVal = "0",note = "零售价格")
	protected Integer payMoney;

	@Column(name = "stock_num",notNull = true,defVal = "0",note="库存")
	protected Integer stockNum;

	@Column(defVal="1")
	protected Integer state;

	@Column(name = "audit_id",note="当前审核Id")
	protected Long auditId;

	@Column(name = "audit_state",defVal="1",note="审核状态")
	protected Integer auditState;

	@Column(name = "audit_note",length = 255,note="审核描述")
	protected String auditNote;

	@Column(name = "update_date", autoUpdateTime = true)
	protected Date updateDate;

	@Column(name = "create_date")
	protected Date createDate;

	private String[] imgPaths;
	private String[] detailImgPaths;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Integer getClassify() {
		return classify;
	}

	public void setClassify(Integer classify) {
		this.classify = classify;
	}

	public String getTypeCodes() {
		return typeCodes;
	}

	public void setTypeCodes(String typeCodes) {
		this.typeCodes = typeCodes;
	}

	public String getTypeNames() {
		return typeNames;
	}

	public void setTypeNames(String typeNames) {
		this.typeNames = typeNames;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getImgs() {
		return imgs;
	}

	public void setImgs(String imgs) {
		this.imgs = imgs;
	}

	public String getDetailImgs() {
		return detailImgs;
	}

	public void setDetailImgs(String detailImgs) {
		this.detailImgs = detailImgs;
	}

	public Integer getPayMoney() {
		return payMoney;
	}

	public void setPayMoney(Integer payMoney) {
		this.payMoney = payMoney;
	}

	public String getLabels() {
		return labels;
	}

	public void setLabels(String labels) {
		this.labels = labels;
	}

	public String getThumbnailImg() {
		return thumbnailImg;
	}

	public void setThumbnailImg(String thumbnailImg) {
		this.thumbnailImg = thumbnailImg;
	}

	public Integer getStockNum() {
		return stockNum;
	}

	public void setStockNum(Integer stockNum) {
		this.stockNum = stockNum;
	}

	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	public Long getAuditId() {
		return auditId;
	}

	public void setAuditId(Long auditId) {
		this.auditId = auditId;
	}

	public Integer getAuditState() {
		return auditState;
	}

	public void setAuditState(Integer auditState) {
		this.auditState = auditState;
	}

	public String getAuditNote() {
		return auditNote;
	}

	public void setAuditNote(String auditNote) {
		this.auditNote = auditNote;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getPayMoneyStr() {
		return NumberTools.getMoneyStr(this.payMoney);
	}

	public String getStateName() {
		return SupplierGoodsEnum.State.note(this.state);
	}

	public String getAuditStateName(){
		return SupplierGoodsEnum.AuditState.note(this.auditState);
	}

	public String getClassifyName(){
		return EGoodsClassify.note(this.classify);
	}

	public String[] getImgPaths(){
		if(this.imgPaths == null && StringUtils.isNotBlank(this.getImgs())){
			this.imgPaths = this.getImgs().split("\\|");
		}
		return imgPaths;
	}

	public String[] getDetailImgPaths(){
		if(this.detailImgPaths == null && StringUtils.isNotBlank(this.getDetailImgs())){
			this.detailImgPaths = this.getDetailImgs().split("\\|");
		}
		return detailImgPaths;
	}

	public void setImgPaths(String[] imgPaths) {
		this.imgPaths = imgPaths;
	}

	public void setDetailImgPaths(String[] detailImgPaths) {
		this.detailImgPaths = detailImgPaths;
	}
}
